package com.xiu.travel.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 基础类
 *
 * @author yingyingying
 * @date 2023/3/13 20:42
 */
@Schema(description = "基础类")
@Data
public class BasePojo implements Serializable
{
    @Schema(description = "创建者",hidden = true)
    @TableField(fill = FieldFill.INSERT)
    protected Long creator;

    @Schema(description = "修改者",hidden = true)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    protected Long updater;

    @Schema(description = "创建时间",hidden = true)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    @Schema(description = "修改时间",hidden = true)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @Schema(description = "状态",hidden = true)
    private Integer status;

    @TableLogic
    @Schema(description = "删除标志",hidden = true)
    protected Integer deleted;

    @Version
    @Schema(description = "乐观锁",hidden = true)
    private Integer version;

}
